#ifndef WF_PLAYER_FFMPEG_H
#define WF_PLAYER_FFMPEG_H

#include "JniCallJava.h"
#include <pthread.h>
#include "AudioPlay.h"

extern "C" {
#include "libavformat/avformat.h"
#include "libswresample/swresample.h"
}

class FFmpegPlay {
public:
    AVFormatContext *pAvFormatContext = nullptr;
    char *mediaUrl = nullptr;
    JniCallJava *pJniCallJava = nullptr;
    AudioPlay *pAudioPlay = nullptr;

public:
    FFmpegPlay(JniCallJava *jniCallJava, const char *mediaUrl);

    ~FFmpegPlay();

public:
    void play();

    void prepare();

    void prepareAsync();

    void prepare(ThreadMode threadMode);

    void callOnError(ThreadMode threadMode, int errorCode, char *errorMsg);

    void release();
};


#endif
